package com.hzlx.controller;/*
 *@author liu
 *2024/07/2024/7/25
 *@version
 */

import com.hzlx.common.ResponseBean;
import com.hzlx.service.CustomerInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author UP
 * @Date 2024/7/25 10:00
 * @Version 1.0
 **/
@Controller
@RequestMapping("/customer")
public class CustomerInfoController {

    @Autowired
    private CustomerInfoService customerInfoService;

    @PostMapping("/login")
    @ResponseBody
    public ResponseBean login(String userName, String password,HttpServletRequest request){
        return customerInfoService.login(userName,password,request);
    }

    @ResponseBody
    @GetMapping("/getAll")
    public ResponseBean getAll() {
        return customerInfoService.getAll();
    }
    @PostMapping("/add")
    @ResponseBody
    public ResponseBean add(Integer accountId, Integer beforeBalance, Integer money, Integer cardId) {
        return customerInfoService.add(accountId, beforeBalance, money, cardId);
    }

}
